<body></body>

<h1>Events</h1>

<table>

    <tr>
        <th>Name</th>
		<th>Description</th>
		<th>Progress</th>
        <th>Status</th>
		<th>Creator</th>
        <th>Actions</th>
    </tr>

    <?php for( $i = 0; $i<sizeof($events) ; $i++)
	{ ?>
    <tr>
       <td>
            <?php echo $this->Html->link($events[$i]['Event']['name'], array('action' => 'view', $events[$i]['Event']['id']));?>
        </td>
			<td><?php echo $events[$i]['Event']['description']; ?></td>
			<td><?php echo $events[$i]['Event']['status']; ?></td>
            <td><?php if($eventsstatus[$i] == true)
            {
                 echo 'Approved';
            }
            else
            {
               echo 'Not Approved'; 
            }  ?></td>
			<td><?php echo $names[$i]['User']['fullname']; ?></td>
        <td>
            <?php echo $this->Form->postLink(
                'Delete',
                array('action' => 'deleteevent', $events[$i]['Event']['id']));
            ?>
            &nbsp;|&nbsp;
            <?php echo $this->Html->link('Edit', array('action' => 'edit', $events[$i]['Event']['id']));?>
            <?php if($events[$i]['Event']['status'] == 'complete' && $eventsstatus[$i] == false)
            {
                ?>
                
            
            &nbsp;|&nbsp;
            <?php 
            echo $this->Html->link('Approve Event', array('action' => 'approve', $events[$i]['Event']['id'] ,$events[$i]['Event']['status'] ));
            }
            ?>
			
        </td>
      
    </tr>
    <?php } ?>

</table>
<p><?php echo $this->Html->link('Add Event', array('action' => 'add')); ?></p>
